package me.ilich.piet.interpreter.commands;

import me.ilich.piet.interpreter.Stack.Context;

public abstract class UnaryReplaceCommand extends UnaryCommand {

	@Override
	protected void onUnary(Context context, int a, int size) {
		int b = onUnaryReplace(context, a);
		context.getStackState().getData().remove(size-1);
		context.getStackState().getData().add(Integer.valueOf(b));
	}

	protected abstract int onUnaryReplace(Context context, int a);

}
